﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ExportToRTR.CApExportToRTRLink
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Collections.Generic;


namespace DnProcessSimulateCommands.ExportToRTR{

internal class CApExportToRTRLink : ICApExportToRTRWriteable, ILink
{
  private CApExportToRTRInertial m_inertial;
  private List<CApExportToRTRVisual> m_visuals;
  private List<CApExportToRTRCollision> m_collisions;

  public string Name { get; set; }

  public CApExportToRTRLink(string name, CApExportToRTRInertial inertial = null)
  {
    this.Name = name;
    this.m_inertial = inertial;
    this.m_visuals = new List<CApExportToRTRVisual>();
    this.m_collisions = new List<CApExportToRTRCollision>();
  }

  public void Write(CApExportToRTRXmlWriter writer)
  {
    writer.WriteStartElement("link");
    writer.WriteAttributeString("name", this.Name);
    this.m_inertial?.Write(writer);
    foreach (CApExportToRTRVisual visual in this.m_visuals)
      visual.Write(writer);
    foreach (CApExportToRTRCollision collision in this.m_collisions)
      collision.Write(writer);
    writer.WriteEndElement();
  }

  public void AddVisual(CApExportToRTRVisual visual) => this.m_visuals.Add(visual);

  public void AddCollision(CApExportToRTRCollision collision) => this.m_collisions.Add(collision);
}
